using imitateMacQQ.WebApi.Domain.FirstCode.schema;
using imitateMacQQ.WebApi.Repository.EFCore.Model.Circle;
using imitateMacQQ.WebApi.Repository.EFCore.Model.LoginPhoneCode;
using Microsoft.EntityFrameworkCore;

namespace imitateMacQQ.WebApi.Repository.EFCore.Model;

public class DataDbContext : DbContext
{
    public DbSet<User> Users { get; set; }
    public DbSet<Buddy> Buddies { get; set; }
    public DbSet<RealTimeInfo> RealTimeInfos { get; set; }
    public DbSet<Background> Backgrounds { get; set; }


    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        var usr = Admin.Usr;
        var pwd = Admin.Pwd;
        var catalog = Admin.Catalog;
        var port = Admin.Port;
        var configStr =
            $"Data Source=localhost;port={port};" +
            $"Initial Catalog={catalog};" +
            $"user id={usr};password={pwd};" +
            $"Character Set=utf8";
        optionsBuilder.UseMySql(configStr,
            new MySqlServerVersion(new Version(5, 0, 7)));
    }

    //朋友圈
    public DbSet<FriendCircle> FriendCircles { get; set; }
    public DbSet<Remark> Remarks { get; set; }
    public DbSet<Like> Likes { get; set; }
    public DbSet<LikeMes> LikeMes { get; set; }
    public DbSet<RemarksMes> RemarksMes { get; set; }

    //注册
    public DbSet<PhoneCode> PhoneCodes { get; set; }
}